import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import '../../../shared/shared.dart';

class InputField extends StatelessWidget {
  final TextEditingController controller;
  final TextInputType keyboardType;
  final String hintText;
  final bool password;
  final String? Function(String?)? validator;

  const InputField(
      {Key? key,
      required this.hintText,
      required this.controller,
      required this.keyboardType,
      this.validator,
      this.password = false})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.symmetric(horizontal: 36),
      child: Row(
        children: [
          Container(
            margin: const EdgeInsets.symmetric(horizontal: 5),
            width: 30,
            height: 30,
            decoration: BoxDecoration(
                // color: ColorConstants.selectColor,
                color: Colors.transparent,
                shape: BoxShape.circle,
                border: Border.all(color: ColorConstants.themeColor, width: 2)),
          ),
          Expanded(
            child: TextFormField(
                controller: controller,
                decoration: InputDecoration(
                    fillColor: Colors.transparent,
                    contentPadding: const EdgeInsets.symmetric(vertical: 10.0),
                    hintText: hintText,
                    hintStyle: const TextStyle(color: ColorConstants.themeColor),
                    focusedBorder: const UnderlineInputBorder(
                        borderSide: BorderSide(
                            color: ColorConstants.selectColor, width: 2)),
                    enabledBorder: const UnderlineInputBorder(
                        borderSide: BorderSide(color: ColorConstants.themeColor, width: 2)),
                    errorBorder: const UnderlineInputBorder(
                        borderSide: BorderSide(color: ColorConstants.themeColor, width: 2)),
                    focusedErrorBorder: const UnderlineInputBorder(
                        borderSide: BorderSide(color: ColorConstants.selectColor, width: 2)),
                    errorStyle:
                        const TextStyle(color: ColorConstants.selectColor,fontSize: 14)),
                style: const TextStyle(color: ColorConstants.themeColor),
                validator: validator,
                keyboardType: keyboardType,
                obscureText: password),
          )
        ],
      ),
    );
  }
}
